#include <unistd.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char ** argv)
{
    pid_t pid;
    pid_t pid2;
    int ret;
    pid = fork();
    if(pid == 0)
    {
        printf("child pro pid is %d -- father pid is %d\n",getpid(),getppid());
        exit(0);
    }
    else if(pid >  0)
    {
        pid2 = wait(&ret);
        printf("father pro pid is %d\n",getpid());
        printf("child id is %d  --- return value:%d\n",pid2,ret);

        sleep(10);
    }
    else
    {
        perror("fork");
    }
    return 0;
}
